A virtual machine environment provides a convenient platform for efficient logging and replaying execution. Logging and replaying execution of a virtual machine has several applications such as, for example, debugging, fault tolerance, and trace driven simulations. For example, logging and replaying allows a computer architect to perform detailed analysis of run-time information in an offline environment using trace simulations. Logging and replay can also be used to improve fault tolerance by enabling a virtual machine to recover from a system error by replaying execution from the last known save point. With regard to debugging, logging and replaying allows an analyst to identify what causes a software bug to occur by recording the computer operation when the error is reproduced, and then stepping through the execution while reviewing the system state at each step to identify the cause.
A conventional execution logging and replay system typically uses specialized hardware that monitors and logs every instruction executed by the processor. However, these conventional trace collection techniques are often slow due to software tracing overhead. Furthermore, special tracing hardware can be expensive.